From 498121d145844cd8ff28279a49c43dfbfb080299 Mon Sep 17 00:00:00 2001
From: real-zephex <zephex-1@outlook.com>
Date: Mon, 8 Apr 2024 01:51:13 +0530
Subject: small chanegs here and there, manga and anime pages are currently
 broken. changed the image proxy to cloudflare workers.

---
 src/app/manga/[title]/[id]/[read]/page.jsx | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

(limited to 'src/app/manga/[title]/[id]/[read]/page.jsx')

diff --git a/src/app/manga/[title]/[id]/[read]/page.jsx b/src/app/manga/[title]/[id]/[read]/page.jsx
index fa338ac..faa5999 100644
--- a/src/app/manga/[title]/[id]/[read]/page.jsx
+++ b/src/app/manga/[title]/[id]/[read]/page.jsx
@@ -7,8 +7,10 @@ export const runtime = "edge";
 
 export default async function Read({ params }) {
 	const chapterId = params.read;
-	const data = await getPages(chapterId);
-	if (data.length === 0) {
+	const results = await getPages(chapterId);
+	const image_base_url = results.baseUrl + "/data/" + results.chapter.hash;
+
+	if (results.length === 0) {
 		return (
 			<div className={styles.NotFound}>
 				<p>
@@ -19,8 +21,8 @@ export default async function Read({ params }) {
 	}
 
 	let images = [];
-	for (var i = 0; i < data.length; i++) {
-		var imgUrl = data[i].img;
+	for (var i = 0; i < results.chapter.data.length; i++) {
+		var imgUrl = image_base_url + "/" + results.chapter.data[i];
 		images.push(imgUrl);
 	}
 
@@ -52,9 +54,7 @@ export default async function Read({ params }) {
 }
 
 async function getPages(id) {
-	const res = await fetch(
-		`https://consumet-api-di2e.onrender.com/meta/anilist-manga/read?chapterId=${id}&provider=mangadex`
-	);
+	const res = await fetch(`https://api.mangadex.org/at-home/server/${id}`);
 	const data = await res.json();
 	return data;
 }
-- 
cgit v1.2.3

